package com.runssnail.demo.btrace;

import com.sun.btrace.annotations.*;

import static com.sun.btrace.BTraceUtils.*;

/**
 * 将BtraceTest放在${BtraceHome}下
 * 用jps查看进程pid
 * 然后执行./bin/btrace pid BtraceTest.java
 * <p>
 * Created by zhengwei on 2016/11/21.
 */
@BTrace
public class BtraceTest {

    static {
        println("---------------------------JVM properties:---------------------------");
        printVmArguments();
        println("---------------------------System properties:------------------------");
        printProperties();
        println("---------------------------OS properties:----------------------------");
        printEnv();
//        exit();
    }

    @OnMethod(
            clazz = "com.runssnail.jhw.biz.product.service.impl.ProductServiceImpl",
            method = "selectById",
            location = @Location(Kind.RETURN)
    )
    public static void trace1(Long id) {
        println("trace1:id=" + id);
    }

}
